﻿@model PagedList.IPagedList<MiscellaneousShop.Models.FrontViewProductModel>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_MasterPage.cshtml";
    var ImageFolder = "../../Images/Products/";
}

<script type ="text/javascript">
    $("#keyword").val("@ViewBag.Keyword");
</script>

<h2>All Product</h2>

<div>
    Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    of @Model.PageCount
     
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<", "Index", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
        @Html.Raw(" ");
        @Html.ActionLink("< Prev", "Index", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
    }
    else
    {
        @:<<
        @Html.Raw(" ");
        @:< Prev
    }
     
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("Next >", "Index", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
        @Html.Raw(" ");
        @Html.ActionLink(">>", "Index", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
    }
    else
    {
        @:Next >
        @Html.Raw(" ")
        @:>>
    }
</div>
    
@foreach (var item in Model) {
    <div class="product_box">
        <a href="#"><img src="@ImageFolder@item.ProductMainPhoto" alt="@item.ProductMainPhoto" /></a>
        <h3>@item.ProductName</h3>
        <p class="product_price">@item.CurrentPrice</p>
        <a href="#" class="add_to_card">Add to Cart</a>
        <a href="#" class="detail">Detail</a>
    </div>
}

